//1.制定路由规则
//2.造一个路由器管理这些规则
import Vue from 'vue'
import VueRouter from 'vue-router'
//引入各个组件
import About from '../pages/About.vue'
import Home from '../pages/Home.vue'
import News from '../pages/News.vue'
import Message from '../pages/Message.vue'

Vue.use(VueRouter)

//造一个路由器
const router = new VueRouter({
	//工作模式
	mode:'history',
	//编写一堆具体规则
	routes:[
		{
			name:'guanyu',
			path:'/about',
			component:About
		},
		{
			name:'zhuye',
			path:'/home',
			component:Home,
			children:[
				{
					name:'xinwen',
					path:'news', //此处一定不要写"/"
					component:News
				},
				{
					name:'xiaoxi',
					path:'message',
					component:Message
				}
			]
		}
	]
})

//暴露路由器
export default router